Skip to content

feat(generator): 添加对继承层次结构中注册方法的支持#214

Merged
GeWuYou merged 5 commits into
mainfrom
feat/generator-inheritance-support
Apr 13, 2026
Merged

feat(generator): 添加对继承层次结构中注册方法的支持#214
GeWuYou merged 5 commits into
mainfrom
feat/generator-inheritance-support

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Apr 13, 2026

Copy link
Copy Markdown
Owner
  • 实现 EnumerateCandidateMethods 方法以搜索基类和接口中的注册方法
  • 修改 AutoRegisterExportedCollectionsGenerator 以支持从继承链中查找兼容的注册方法
  • 添加完整的单元测试覆盖继承、接口实现和泛型场景
  • 修复静态成员和不可访问方法的诊断报告功能
  • 增强源代码生成器对复杂继承结构的支持能力

Summary by CodeRabbit

发布说明

  • 错误修复

    • 改进了对注册成员的解析与可访问性判定,能可靠识别继承链中来自接口或基类的注册方法与字段,提升批量注册生成的准确性并减少错误生成。
    • 生成器在遇到不支持的类型时会明确失败以避免不确定输出。
  • 测试

    • 新增多项单元测试,覆盖注册方法/字段来自继承接口或基类、及显式接口实现导致的诊断触发情形。

- 实现 EnumerateCandidateMethods 方法以搜索基类和接口中的注册方法
- 修改 AutoRegisterExportedCollectionsGenerator 以支持从继承链中查找兼容的注册方法
- 添加完整的单元测试覆盖继承、接口实现和泛型场景
- 修复静态成员和不可访问方法的诊断报告功能
- 增强源代码生成器对复杂继承结构的支持能力
@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

扩展源生成器以向上查找 registry 字段/属性并在基类与接口继承链中枚举注册方法;加强可访问性与类型兼容性检查;支持为接口生成 partial 声明;新增多项单元测试覆盖基接口、基类、基类 registry 和显式接口实现的场景。

Changes

Cohort / File(s) Summary
源生成器逻辑
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
新增 FindRegistryMember(沿 BaseType 向上搜索实例字段/属性,保留隐藏顺序);用 EnumerateCandidateMethods 枚举注册方法候选(包括类型自身、基类链及当 registry 静态类型为接口时的继承接口方法);增加 compilation.IsSymbolAccessibleWithin(registryMember, ownerType) 可访问性校验;支持为接口生成 partial interface,对不支持的 TypeKind 抛出 NotSupportedException
单元测试 — 正常与错误路径
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
新增四个测试:Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_InterfaceGenerates_Batch_Registration_Method_When_Register_Method_Comes_From_Base_ClassGenerates_Batch_Registration_Method_When_Registry_Member_Comes_From_Base_Class(验证在继承链上发现 register/registry 时生成正确的批量注册调用与空值保护),以及 Reports_Diagnostic_When_Register_Method_Is_Only_Explicitly_Implemented_Interface_Member(验证在 register 方法仅为显式接口实现时跳过生成并报告 GF_AutoExport_003)。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了PR的主要改动,即为代码生成器添加对继承层次结构中注册方法的支持,这与摘要和目标描述一致。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/generator-inheritance-support

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Apr 13, 2026

Copy link
Copy Markdown

Greptile Summary

This PR extends AutoRegisterExportedCollectionsGenerator to resolve compatible register methods not only on the registry type itself but also in its base class hierarchy and all transitively implemented interfaces, via the new EnumerateCandidateMethods helper. It also fixes diagnostic location reporting for static members and adds tests covering the interface-inheritance path and several diagnostic scenarios.

The core logic is sound — AllInterfaces correctly expands the full interface graph, and the .Any() consumer means that occasional duplicate method candidates are harmless. Three non-blocking P2 issues were identified:

  • EnumerateCandidateMethods lacks inline comments explaining its traversal strategy, duplicate-yield safety, and the interface-as-registry-type edge case — required by AGENTS.md for non-trivial logic.
  • Test coverage only exercises the interface-inheritance path; the concrete base-class path (BaseType loop) has no dedicated test.
  • A pre-existing asymmetry is made more visible: registryMember lookup does not walk the owner type's hierarchy, causing a spurious GF_AutoExport_002 when the registry field is declared on a base class.

Confidence Score: 4/5

Safe to merge with minor documentation and test-coverage gaps; no correctness or security issues found.

The core EnumerateCandidateMethods logic is sound — traversal order is correct, AllInterfaces is already transitive, and .Any() safely handles duplicate yields. All new diagnostic tests have correct expectations. The two remaining gaps (missing inline comments per AGENTS.md, no test for the concrete base-class inheritance path) are non-blocking P2 issues that do not affect runtime correctness.

Both changed files have minor gaps: the generator needs comments on EnumerateCandidateMethods, and the test file needs a base-class inheritance test case.

Important Files Changed

Filename Overview
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs Adds EnumerateCandidateMethods to walk the full inheritance chain (direct type → base classes → AllInterfaces). Logic is correct and the .Any() consumer makes duplicate yields safe, but the method lacks inline comments required by AGENTS.md, and the registry-member lookup remains limited to directly declared members.
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs Adds tests for the interface-inheritance path, static-member and inaccessible-method diagnostics. Missing a test for the concrete base-class inheritance path, which is the other half of the feature described in the PR.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[TryCreateRegistration] --> B[EnumerateCandidateMethods]
    B --> C["registryType.GetMembers(name)\n(direct declaration)"]
    C --> D["BaseType loop\n(walk concrete hierarchy)"]
    D --> E["AllInterfaces loop\n(transitive interface graph)"]
    C & D & E --> F[".Any() filter:\n!IsStatic && Params==1 &&\nIsAccessible && CanAcceptElementType"]
    F -->|"match found"| G[hasCompatibleMethod = true]
    F -->|"no match"| H[Report GF_AutoExport_003]
    G --> I[new RegistrationSpec]
    I --> J[GenerateSource]
Loading

Comments Outside Diff (1)

  1. GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs, line 224-237 (link)

    P2 Registry-member lookup doesn't walk the owner type's hierarchy — asymmetric with the new method lookup

    EnumerateCandidateMethods now correctly walks the full inheritance chain of the registry type to find the register method. However, the corresponding registry member lookup on the owner type uses ownerType.GetMembers(registryMemberName), which (in Roslyn) only returns members directly declared on that type, not inherited ones.

    This means that if a user declares the registry field on a base class, the generator reports RegistryMemberNotFound (GF_AutoExport_002) even though the generated this._registry.Register(...) call would compile fine.

    The inconsistency is pre-existing, but this PR makes it more visible by adding inheritance awareness on one side of the validation while leaving the other side flat. A follow-up change should extend the registry member search to walk the owner type's base class chain, analogously to EnumerateCandidateMethods.

Reviews (1): Last reviewed commit: "feat(generator): 添加对继承层次结构中注册方法的支持" | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs (1)

321-339: 建议为候选方法遍历逻辑补充方法级说明注释

EnumerateCandidateMethods 是这次行为变更的核心入口,建议补充注释说明“为何遍历当前类型/基类/接口、语义假设以及不去重的影响边界”,方便后续维护和诊断。

As per coding guidelines: Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling,并且 Generated logic and source generator pipelines MUST explain ... semantic assumptions ...

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs`
around lines 321 - 339, Add a method-level XML/summary comment to
EnumerateCandidateMethods that documents the intent and semantics: explain that
it yields IMethodSymbol candidates by name from the current registryType, then
walks baseType chain, then iterates AllInterfaces; state the semantic
assumptions about inheritance vs. interface declarations, that it does not
deduplicate identical symbols (and why that is acceptable), and note edge cases
such as shadowing, explicit interface implementations, and null BaseType
handling; reference the parameters registryType and registerMethodName and the
expected result so future maintainers understand the traversal order and
rationale.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 203-279: Add a regression test covering the generator branch that
traverses base classes: create a new test in
AutoRegisterExportedCollectionsGeneratorTests (modeled on
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface)
that defines BaseRegistry with the Register(…) method, a DerivedRegistry :
BaseRegistry used as the field type (e.g., _registry), and a class with
[RegisterExportedCollection(..., "Register")] pointing to that registry; run the
generator and assert the generated partial class (e.g.,
TestApp_Bootstrapper.AutoRegisterExportedCollections.g.cs) contains calls to
this._registry.Register(__generatedItem) to lock in the base-class traversal
behavior.

---

Nitpick comments:
In
`@GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs`:
- Around line 321-339: Add a method-level XML/summary comment to
EnumerateCandidateMethods that documents the intent and semantics: explain that
it yields IMethodSymbol candidates by name from the current registryType, then
walks baseType chain, then iterates AllInterfaces; state the semantic
assumptions about inheritance vs. interface declarations, that it does not
deduplicate identical symbols (and why that is acceptable), and note edge cases
such as shadowing, explicit interface implementations, and null BaseType
handling; reference the parameters registryType and registerMethodName and the
expected result so future maintainers understand the traversal order and
rationale.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 012fc5dc-1d26-4586-ba14-0740af8e75af

📥 Commits

Reviewing files that changed from the base of the PR and between 3f237ef and 5e1e16f.

📒 Files selected for processing (2)
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and Test
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces use I prefix, parame...

Files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🧠 Learnings (6)
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers

Applied to files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🔇 Additional comments (1)
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs (1)

271-277: 继承链方法匹配的兼容性过滤实现合理

这里保留了非静态、单参数、可访问性与隐式转换校验,能有效避免把不可调用签名错误地当作可注册方法。

- 添加了针对注解集合生成批处理注册方法的测试用例
- 添加了当集合元素类型无法推断时报告诊断的测试
- 添加了注册方法使用数组参数时的批处理注册测试
- 添加了从继承接口获取注册方法的批处理注册测试
- 添加了从基类获取注册方法的批处理注册测试
- 添加了当集合成员不可实例读取时报告诊断的测试
- 添加了当注册成员不可实例读取时报告诊断的测试
- 添加了当注册方法对所有者类型不可访问时报告诊断的测试
- 添加了当注册导出集合属性参数无效时报告诊断的测试
- 添加了多个分部声明注解时仅生成一个源文件的测试
- 为枚举候选方法功能添加了详细的XML文档注释

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs`:
- Around line 348-352: The generator currently iterates
registryType.AllInterfaces unconditionally which pulls in explicitly-implemented
interface methods (e.g., void IRegistry.Register(T)) and leads to emitted calls
like this.registry.Register(item) that won't compile on class/struct registry
fields; restrict that interface traversal so it only runs when registryType is
an interface (check registryType.TypeKind == TypeKind.Interface) before
iterating AllInterfaces and collecting IMethodSymbol members for
registerMethodName, otherwise only consider members directly on registryType.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6d783b93-4129-440e-ae9b-c11b9b7c6fc3

📥 Commits

Reviewing files that changed from the base of the PR and between 5e1e16f and 812235a.

📒 Files selected for processing (2)
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces use I prefix, parame...

Files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🧠 Learnings (4)
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions

Applied to files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling

Applied to files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : All public, protected, and internal types and members MUST include XML documentation comments (`///`) with `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` tags where applicable

Applied to files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🔇 Additional comments (1)
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs (1)

271-277: 候选方法过滤条件设计合理

这里把静态性、参数个数、可访问性和隐式转换统一放在同一处筛选,能有效避免误选不可调用方法,诊断路径也保持清晰。

- 实现了 AutoRegisterExportedCollectionsGenerator 源生成器
- 支持扫描标记了 AutoRegisterExportedCollectionsAttribute 的 partial 类型
- 为使用 RegisterExportedCollectionAttribute 声明的集合成员生成集中注册方法
- 提供详细的诊断支持,包括 GF_AutoExport_001 到 GF_AutoExport_008 错误码
- 支持从基类和接口继承链查找注册方法
- 实现了完整的单元测试覆盖各种使用场景
- 验证集合可枚举性、元素类型推导和注册表成员可访问性
- 生成安全的空值检查代码防止运行时异常
- 支持泛型类型约束和复杂继承关系的处理

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

- 将条件判断语句替换为 switch 表达式以提高可读性
- 添加对 partial interface 类型的支持
- 为不支持的类型添加异常处理机制
- 简化代码结构并提升维护性

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs (1)

203-279: 为新增的 public 测试补齐 XML 文档。

Lines 204、282、342、412 这 4 个 public async Task 用例都没有 /// 注释;按仓库规则,这里至少应补一个 <summary>,把各自锁定的继承链/显式接口回归点写清楚,后续排查失败原因会更直接。

📝 一种最小补法
+    /// <summary>
+    /// 验证当注册方法声明在继承接口上时,生成器仍会生成批量注册代码。
+    /// </summary>
     [Test]
     public async Task Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface()

As per coding guidelines:All public, protected, and internal types and members MUST include XML documentation comments ('///') with '<summary>', '<param>', '<returns>', '<exception>', and '<remarks>' tags where applicable

Also applies to: 281-339, 341-409, 411-478

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`
around lines 203 - 279, Add XML documentation comments (at minimum a ///
<summary>) to the public test method
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface
and the three other public async Task test methods in this test file (the ones
starting near lines 282, 342, 412); each <summary> should succinctly state what
the test verifies (e.g., that the generator emits a batch registration method
when the register method is declared on an inherited/explicit interface) so
future failures point immediately to the intended inheritance/explicit-interface
behavior being tested.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 324-332: The test instantiates a
CSharpSourceGeneratorTest<AutoRegisterExportedCollectionsGenerator,
DefaultVerifier> and sets TestBehaviors =
TestBehaviors.SkipGeneratedSourcesCheck; remove that SkipGeneratedSourcesCheck
entry so the test no longer bypasses generated-source verification (i.e., delete
or omit the TestBehaviors assignment that references
TestBehaviors.SkipGeneratedSourcesCheck from the test variable initialization),
ensuring the generator output (any .g.cs files) is validated by the test
harness.

---

Nitpick comments:
In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 203-279: Add XML documentation comments (at minimum a ///
<summary>) to the public test method
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface
and the three other public async Task test methods in this test file (the ones
starting near lines 282, 342, 412); each <summary> should succinctly state what
the test verifies (e.g., that the generator emits a batch registration method
when the register method is declared on an inherited/explicit interface) so
future failures point immediately to the intended inheritance/explicit-interface
behavior being tested.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8ae182f2-4cbb-48ab-b790-1e3ee091b7fe

📥 Commits

Reviewing files that changed from the base of the PR and between 812235a and 56bc078.

📒 Files selected for processing (2)
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces use I prefix, parame...

Files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🧠 Learnings (11)
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs

- 添加了批量注册方法生成的基础功能测试
- 添加了集合元素类型推断失败时的诊断报告测试
- 添加了数组参数注册方法的生成测试
- 添加了从继承接口获取注册方法的测试
- 添加了显式接口实现成员不可访问的诊断测试
- 添加了从基类获取注册方法的测试
- 添加了从基类获取注册器成员的测试
- 添加了非实例可读集合成员的诊断测试
- 添加了非实例可读注册器成员的诊断测试
- 添加了注册方法不可访问的诊断测试
- 添加了属性参数无效时的诊断测试
- 添加了多个分部声明时只生成一个源文件的测试

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs (1)

203-477: 为新增 public 测试补齐 XML 文档。

这 4 个新增 public async Task 测试方法没有 /// 注释;按仓库规则,新增的 public 成员需要补 <summary>,并在适用时补 <returns><remarks> 等说明。

As per coding guidelines "All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`
around lines 203 - 477, The four new public test methods
(Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface,
Reports_Diagnostic_When_Register_Method_Is_Only_Explicitly_Implemented_Interface_Member,
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Base_Class,
Generates_Batch_Registration_Method_When_Registry_Member_Comes_From_Base_Class)
are missing XML documentation; add a /// <summary> describing the purpose of
each test and a /// <returns> explaining the async Task result, and include
additional tags like <remarks> if needed per guidelines so each public async
Task method has appropriate XML doc comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 203-477: The four new public test methods
(Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface,
Reports_Diagnostic_When_Register_Method_Is_Only_Explicitly_Implemented_Interface_Member,
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Base_Class,
Generates_Batch_Registration_Method_When_Registry_Member_Comes_From_Base_Class)
are missing XML documentation; add a /// <summary> describing the purpose of
each test and a /// <returns> explaining the async Task result, and include
additional tags like <remarks> if needed per guidelines so each public async
Task method has appropriate XML doc comments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4966f6e8-8867-47cd-8325-402eeb5379ac

📥 Commits

Reviewing files that changed from the base of the PR and between 56bc078 and 973a3c3.

📒 Files selected for processing (2)
  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces use I prefix, parame...

Files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🔇 Additional comments (4)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs (4)

203-279: 接口继承链的回归覆盖到位。

这个用例准确锁定了接口类型注册表沿继承接口查找注册方法的分支,而且断言的是最终生成结果,粒度合适。

Based on learnings: Source generator changes MUST be covered by generator tests and Keep tests focused on observable behavior, not implementation trivia


281-338: 显式接口实现的负向场景补得很好。

这里只期望 GF_AutoExport_003,能防止生成器把只能经接口调用的显式实现误判为可直接调用成员,正好锁住这次修复边界。

Based on learnings: Regression fixes should include a test that fails before the fix and passes after it


340-408: 基类声明注册方法的分支已经被锁住。

DerivedRegistry : BaseRegistry 配合生成结果快照,直接覆盖了沿基类链枚举注册方法的新增逻辑。

Based on learnings: Source generator changes MUST be covered by generator tests and Preserve snapshot-based verification patterns already used in the repository for source generator tests


410-477: 基类上的 registry 成员解析也覆盖到了。

这个场景把 owner 继承链上的成员查找和最终生成调用一起验证了,能很好兜住后续回归。

Based on learnings: Source generator changes MUST be covered by generator tests and Regression fixes should include a test that fails before the fix and passes after it

@GeWuYou GeWuYou merged commit 59e0c4e into main Apr 13, 2026
7 checks passed
@GeWuYou GeWuYou deleted the feat/generator-inheritance-support branch April 13, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant